package org.common.utils;

import cn.hutool.core.codec.Base64;
import cn.hutool.core.util.CharsetUtil;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.crypto.symmetric.AES;

public class AESUtils {
	private static final String AES_KEY = "dhH78U+myTnB2O9gvEzlQA==";
    
    public static String encodeToken(final String content) {
        final byte[] key = Base64.decode(AES_KEY);
        final AES aes = SecureUtil.aes(key);
        return aes.encryptHex(content);
    }
    
    public static String decodeToken(final String content) {
        final byte[] key = Base64.decode(AES_KEY);
        final AES aes = SecureUtil.aes(key);
        return aes.decryptStr(content, CharsetUtil.CHARSET_UTF_8);
    }
}
